<template>
		<div style="width: 100%;height: 100%;">
			<router-view style="height: 100%;"></router-view>
			
		<mu-paper style="position: fixed;left:0 ;bottom: 0;z-index: 200;width: 100%;">
		    <mu-bottom-nav 
			:value="bottomNav"  
			@change="handleChange" 
			v-show="showNav" 
			style="background-color:white;box-shadow: 0 -2px 3px rgba(200,200,200,0.2);z-index: 100;" >
		      <mu-bottom-nav-item value="hongchangSaleOrderList" to="/hongchangSaleOrderList" title="账户" icon="format_list_bulleted"/>
		      <mu-bottom-nav-item value="hongchangGrantBillsList" to="/hongchangGrantBillsList" title="线上下单" icon="format_list_bulleted"/>
              <mu-bottom-nav-item value="hongchangReportIndex" to="/hongchangReportIndex" title="报表" icon="home"/>
		      <mu-bottom-nav-item value="demoDataCenter" to="/index" title="返回首页" icon="home"/>
		    </mu-bottom-nav>
	    </mu-paper>
	    
	</div>
</template>

<script>
	export default {
		data () {
    		return {
    	  bottomNav: 'hongchangSaleOrderList',
	      bottomNavColor: 'movies',
	      factoryInfo:{},
	      factoryId:'',
	      
	      clientHeight:document.documentElement.clientHeight,
　　　　　　showNav: true,  // 控制按钮盒子显示隐藏
    		}
		},
  		mounted(){
  			
  			window.onresize= ()=>{

            if(this.clientHeight>document.documentElement.clientHeight) {
               this.showNav =false
            }else{
                this.showNav = true
            }

        }
  			
  			
	  		this.factoryId=this.$route.params.factoryId
	  		localStorage.factoryName=this.$route.params.factoryName

	  		var paramData=this.$route.params.factoryId
	  		if(typeof(paramData)!="undefined"){
	  		localStorage.factoryId=this.$route.params.factoryId
	  		this.loginFacotry()
	  		}
   		},
		methods: {
			handleChange (val) {
	      this.bottomNav = val
	  },
	   loginFacotry()
    {
    	let that=this;
    	console.info(localStorage.factoryId)
	    that.axios.post(that.global.homeSrc+'/factoryUser/loginFacotry',{
	      			'factoryId':localStorage.factoryId,
	      			'imei':localStorage.userNumber
	    }).then(function(response){
//			that.factoryInfo
			if(response.data.code!="500"){
			   if(response.data.data.state=="ok"){
			     localStorage.organizeId=JSON.stringify(response.data.data.Organizes[0].ID)
			     localStorage.uid=JSON.stringify(response.data.data.UID)
			     console.log(that.factoryInfo)
			   }
			   else {//提示C#端 正常运行 返回错误信息 如用户名或密码错误  剩下C#运行错误由 SIP 数据中心提示
					that.$router.go(-1)
					that.$message({type: 'info',message: '登录失败,原因:'+response.data.data.msg,duration:1500});
			   }
			}else{
				that.$router.go(-1)
				that.$message({type: 'info',message: '登录失败,原因：'+response.data.msg,duration:1500});
			}
			that.$router.push({
	  		path:'/'+that.bottomNav
	  	})

	    }).catch(function(error){
	    	that.$router.go(-1)
	      	that.$message({type: 'info',message: '登录失败'+error.Message,duration:1500});
	      	console.log('失败')
	    })
    	}
		}
	}
</script>

<style>
</style>